# -*- coding: UTF-8 -*-

import re

# 统计
def alldum():

    data = {}

    fin = open('猜数out.txt', 'r', encoding = 'utf-8')

    for line in fin :
        tp = line.strip()[-2:]
        data[tp] = data.get(tp,0) + 1

    print(data)


    fin.close()


# 从聊天记录提取
def get_items():

    with open('聊天记录.txt', 'r', encoding = 'utf-8') as f:

        rr = re.findall(r'\)\n(【.】【.】【.】\d{1,2}\s?.{2})', f.read())
        text = '\n'.join(rr)

    with open('猜数out.txt', 'w', encoding = 'utf-8') as f:

        # f.writelines(rr)
        f.write(text)

    print ('OK')



alldum()